﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;

namespace Adnc.Application.Shared.WeChat
{
    public static class RegisterServiceExtension
    {
        public static IServiceCollection AddWeChatServices(this IServiceCollection serviceCollection)
        {
            var configuration = serviceCollection.GetConfiguration();
            serviceCollection.Configure<WeChatOption>(configuration.GetSection("WeChat"));
            serviceCollection.AddSingleton<AccessToken>();
            serviceCollection.AddScoped<WeChatService>();
            return serviceCollection;
        }
    }
}
